import React, { Component } from 'react';
import {observer,inject} from 'mobx-react';

@inject('shop')
@observer
class Count extends Component {

    change(flag){
        this.props.shop.changeCount(flag,this.props.index)
    }

    render() {
        console.log(this.props)
        return (
            <div>
                <button onClick={this.change.bind(this,false)}>-</button>
                <span>{this.props.count}</span>
                <button onClick={this.change.bind(this,true)}>+</button>
            </div>
        )
    }
}

export default Count
